﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="frmPedido.aspx.cs" Inherits="Intelsi.WB.frmPedido" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<script type="text/javascript">
    $(document).ready(function () {
        $('#<%= txtFechaentrega.ClientID %>').datepicker()
    });
</script>

    <script type="text/javascript">
        $(function ()
         {
            $("#<%= TxtDesPro.ClientID %>").autocomplete({
                source: "/Service/ProyectoService.asmx/GetFromProyectoBYCriterio",
                minLength: 2,
                focus: function (event, ui) {
                    var select = ui.item;
                    $(this).val(select.label);

                    return false;
                },

                select: function (event, ui) {
                    var select = ui.item;
                    $(this).val(select.label);

                    $('#<%= hfIdProyecto.ClientID %>').val(select.value);
                    $('#<%= TxtOrdeser.ClientID %>').val(select.proyecto.ordenServicio);
                    $('#<%= TxtEmpresa.ClientID %>').val(select.proyecto.empresa);

                    return false;
                }

            }
          );

            $("#<%= TxtDescProdu.ClientID %>").autocomplete({
                source: "/Service/ProductoService.asmx/GetGromProductoByDescripcion",
                minLength: 2,
                focus: function (event, ui) {
                    var select = ui.item;
                    $(this).val(select.label);

                    return false;
                },

                select: function (event, ui) {
                    var select = ui.item;
                    $(this).val(select.label);

                    $('#<%=  hfIdProducto.ClientID %>').val(select.value);
                    $('#<%= TxtCodProd.ClientID %>').val(select.producto.codigo);
                    $('#<%= TxtMarca.ClientID %>').val(select.producto.marca);
                    $("#<%= TxtCantidad.ClientID %>").val("1.00");


                    return false;
                }

            }
          );
        });
    </script>


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="post">
			<h2 class="title">  Pedido  </h2>			
		</div>

        <fieldset>

        <div>
            <fieldset id= "fspedido">
            <br />
                &nbsp;Numero Pedido:
                <asp:TextBox ID="TxtNumPedi" runat="server" Enabled="False"></asp:TextBox>
            
            &nbsp;&nbsp; Fecha:
                <asp:TextBox ID="TxtFechaPedido" runat="server"></asp:TextBox>
            &nbsp;Fecha Entrega:<asp:TextBox ID="txtFechaentrega" runat="server" Height="22px" 
                    Width="110px"></asp:TextBox>
            <br />
            </fieldset>
        <br />
        </div>

        <div>
            <fieldset id="fssupervisor">
                <legend> Datos Supervisor</legend>
                <asp:HiddenField ID="hfIdTrabajador" runat="server" />   
                Apellidos Y nombres:<asp:TextBox ID="TxtNombSup"
                    runat="server" Height="22px" Width="196px"></asp:TextBox>

            &nbsp;DNI:
                <asp:TextBox ID="TxtDniSup" runat="server"></asp:TextBox>

                <br />
                <br />
                Numero Fotochetk:&nbsp;
                <asp:TextBox ID="TxtNumeFotoEmpl" runat="server" Width="152px"></asp:TextBox>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Celular:<asp:TextBox ID="TxtCeluEmpre" runat="server" Width="137px"></asp:TextBox>
                <br />

            </fieldset>
        <br />
        </div>

        <div>

<asp:Panel ID = "panelproyecto" runat ="server">
            <fieldset id="fsproyecto">
                <legend>Datos Proyecto </legend>
                 <asp:HiddenField ID="hfIdProyecto" runat="server" />   
            &nbsp;Ingrese Descripcion Proyecto:
                <asp:TextBox ID="TxtDesPro" runat="server" Width="267px" Height="22px"></asp:TextBox>
                <br />
                <br />
&nbsp;Numero Orden Servicio:
                <asp:TextBox ID="TxtOrdeser" runat="server" Width="122px"></asp:TextBox>
                    
            &nbsp;&nbsp; Empresa:
                <asp:TextBox ID="TxtEmpresa" runat="server" Width="152px"></asp:TextBox>
                    
            </fieldset>
</asp:Panel>
        </div>
<br />
        <div>

<asp:Panel ID = "panelproducto" runat = "server">
            <fieldset id="fsproducto">
                <legend> Productos </legend>
                 <asp:HiddenField ID="hfIdProducto" runat="server" />
            
            &nbsp;Descripcion:
                <asp:TextBox ID="TxtDescProdu" runat="server" Height="22px" Width="249px"></asp:TextBox>
&nbsp;Codigo:<asp:TextBox ID="TxtCodProd" runat="server" Width="103px" Enabled="False"></asp:TextBox>
                <br />
                <br />
&nbsp;Marca:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:TextBox ID="TxtMarca" runat="server" Height="22px" Width="172px" Enabled="False"></asp:TextBox>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Cantidad:<asp:TextBox ID="TxtCantidad" runat="server" Width="112px"></asp:TextBox>

            
            </fieldset> 
</asp:Panel>
            
<asp:Panel ID = "panelaprobador" runat = "server">            
 <fieldset id = "fsAprobador">
     
     <legend> Aprobador</legend>
     <asp:HiddenField ID="hfIdAprobador" runat="server" />
     <table>
     <tr>
        <td>
            <asp:Label ID="lblNombAprob" runat="server" Text="Apellidos y Nombres:"></asp:Label></td>
        <td>
            <asp:TextBox ID="txtNombAprob" runat="server"></asp:TextBox></td>
        <td>
            <asp:Label ID="lblDniAprob" runat="server" Text="DNI: "></asp:Label></td>
        <td>
            <asp:TextBox ID="txtDniAprob" runat="server"></asp:TextBox></td>
     </tr>
     <tr>
        <td>
            <asp:Label ID="lblfotocAprob" runat="server" Text="Nº Fotocheck: "></asp:Label></td>
        <td>
            <asp:TextBox ID="txtfotocAprob" runat="server"></asp:TextBox></td>
        <td>
            <asp:Label ID="lblCeluAprob" runat="server" Text="Celular: "></asp:Label></td>
        <td>
            <asp:TextBox ID="txtCeluAprob" runat="server"></asp:TextBox></td>
     </tr>
     </table>
 </fieldset>       
</asp:Panel>            
        
        <br />

        <asp:Panel ID = "panelAlmacenero" runat = "server">            
 <fieldset id = "Fieldset1">

    <legend>Personal del Almacen</legend>
     <asp:HiddenField ID="hfidalma" runat="server" />
     <table>
     <tr>
        <td>
            <asp:Label ID="Label1" runat="server" Text="Apellidos y Nombres:"></asp:Label></td>
        <td>
            <asp:TextBox ID="txtnombrealama" runat="server"></asp:TextBox></td>
        <td>
            <asp:Label ID="Label2" runat="server" Text="DNI: "></asp:Label></td>
        <td>
            <asp:TextBox ID="txtDnialama" runat="server"></asp:TextBox></td>
     </tr>
     <tr>
        <td>
            <asp:Label ID="Label3" runat="server" Text="Nº Fotocheck: "></asp:Label></td>
        <td>
            <asp:TextBox ID="txtNumerFotocAlma" runat="server"></asp:TextBox></td>
        <td>
            <asp:Label ID="Label4" runat="server" Text="Celular: "></asp:Label></td>
        <td>
            <asp:TextBox ID="txtcelularalama" runat="server"></asp:TextBox></td>
     </tr>
     </table>
 </fieldset>       
</asp:Panel>        


        
        </div>

            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
           
           <asp:Label ID="labelAlerta" 
                runat="server" Text="" style="color: #FF0000"></asp:Label>


            <asp:Button ID="BtnAgregar" runat="server" Text="Agregar" 
                onclick="BtnAgregar_Click" />
&nbsp;<asp:Button ID="btnAgregar2" runat="server" onclick="btnAgregar2_Click" 
                Text="Agregar 2" />
            <br />
            <br />

            <div>
               <asp:UpdatePanel ID="Panelproductos" runat="server">
                   <ContentTemplate>
                       <asp:GridView ID="GrillaPedido" runat="server" AutoGenerateColumns="False" 
                           Width="551px" CellPadding="4" ForeColor="#333333" GridLines="None" 
                           onrowcommand="GrillaPedido_RowCommand">

                           <AlternatingRowStyle BackColor="White" ForeColor="#284775" />

                           <Columns>
                              
                               <asp:TemplateField HeaderText="Codigo">
                               <ItemTemplate>
                                <%#Eval("Codigo")%>
                               </ItemTemplate>

                               </asp:TemplateField>
                               <asp:TemplateField HeaderText="Descripcion">
                                    <ItemTemplate>
                                      <%#Eval("Descripcion")%>
                                    </ItemTemplate>
                               
                               </asp:TemplateField>
                               
                               
                               <asp:TemplateField HeaderText="Marca">
                                    <ItemTemplate>
                                        <%#Eval("NombreMarca")%>
                                    
                                    </ItemTemplate>
                               
                               </asp:TemplateField>
                               

                               <asp:TemplateField HeaderText="Cantidad" InsertVisible="False">
                                    <ItemTemplate>
                                        
                                            
                                            <asp:TextBox ID="txtcantidad" runat="server" Height="20px" Width="43px" 
                                                Text = '<%# Eval("Cantidad") %>' Enabled="<%# EditarCantidad %>"></asp:TextBox>
                       
                                        
                                    </ItemTemplate>
                               </asp:TemplateField>

                               <asp:TemplateField HeaderText="Existencia">
                                    <ItemTemplate>
                                        <%#Eval("Existencia") %>
                                    </ItemTemplate>
                               </asp:TemplateField>

                               <asp:ButtonField ButtonType="Image" CommandName="Quitar" 
                       ImageUrl="~/Styles/images/delete.png" HeaderText="Eliminar" />

                           </Columns>

                           <EditRowStyle BackColor="#999999" />
                           <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                           <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                           <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                           <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                           <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                           <SortedAscendingCellStyle BackColor="#E9E7E2" />
                           <SortedAscendingHeaderStyle BackColor="#506C8C" />
                           <SortedDescendingCellStyle BackColor="#FFFDF8" />
                           <SortedDescendingHeaderStyle BackColor="#6F8DAE" />

                       </asp:GridView>
                   </ContentTemplate>

               </asp:UpdatePanel>
            </div>

        </fieldset>
        <fieldset>
            <asp:Button ID="btnGuardar" runat="server" Text="Guardar" 
                onclick="btnGuardar_Click" style="height: 26px" />
            &nbsp;&nbsp;&nbsp;&nbsp;
            <asp:Button ID="btnCancelar" runat="server" Text="Cancelar" 
                onclick="btnCancelar_Click" />
            &nbsp;&nbsp;&nbsp;&nbsp;
            <asp:Button ID="btnReporte" runat="server" Text="Reporte" 
                onclick="btnReporte_Click" />
        </fieldset>
    
    </asp:Content>
